{% extends "base_generic.html" %}

{% block content %}
<h1>{% if object %}编辑{% else %}添加{% endif %}图书</h1>
<form action="" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    <table>
    {{ form.as_table }}
    </table>
    <input type="submit" value="保存" class="btn btn-primary">
    <a href="{% if object %}{{ object.get_absolute_url }}{% else %}{% url 'books' %}{% endif %}" 
       class="btn btn-secondary">取消</a>
</form>
{% endblock %}